package com.atguigu.yygh.task.job;

import com.atguigu.yygh.mq.MqConst;
import com.atguigu.yygh.mq.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/*==========================================
      时 间:   2022-03-19
      讲 师:   刘  辉
      描 述:   尚硅谷教学团队
 ==========================================*/
@Component
public class ScheduledTask {

    //cron表达式：second minute hour dayOfMonth Month dayOfWeek Year[1970-2099] :七域表达式

    @Autowired
    private RabbitService rabbitService;

    @Scheduled(cron="*/20 * * * * ?")
    public void printTime(){

        rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_TASK,MqConst.ROUTING_TASK_ITEM,"xx");
    }
}
